package com.boot.mall.order.web;

import com.boot.mall.order.mq.JmsProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.UUID;

@Controller
public class HelloController {

    @Autowired
    private JmsProducer jmsProducer;

    @GetMapping("/{page}.html")
    public String getPage(@PathVariable("page") String page){
        System.out.println(page);
        return page;
    }

    @GetMapping("/test/sendMsg")
    @ResponseBody
    public String testSendOrder(){
        String msg = UUID.randomUUID().toString();
        jmsProducer.delaySendMessage(msg,30L);
        System.out.println(jmsProducer);
        System.out.println(msg + "投递成功，30秒之后处理消息...");
        return "ok";
    }

}
